﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Einstein.Group.Model;
using Einstein.Data;

namespace Einstein.Group.BLL
{
    public class UserInfoBLL
    {

        public IList<UserInfoModel> GetAllList()
        {
            using (EinsteinEntities entities = new EinsteinEntities())
            {
                var list = entities.ExecuteStoreQuery<UserInfoModel>("select a.*,b.DeptName,c.UserTypeName,case Sex when 1 then '男' when 0 then '女' else '未知' end as SexName from dbo.UserInfo a,dbo.DeptInfo b,dbo.UserTypeInfo c where a.DeptID=b.DeptID and a.UserTypeID=c.UserTypeID");
                return list.ToList();
            }
        }

        public bool Add(UserInfo info)
        {
            return new DAL.UserInfoDAL().Add(info);
        }
        public bool ExistUserId(UserInfo info, bool IsEdit)
        {
            return new DAL.UserInfoDAL().ExistUserId(info,IsEdit);
        }
        public bool ExistUserName(UserInfo info, bool IsEdit)
        {
            return new DAL.UserInfoDAL().ExistUserName(info, IsEdit);
        }
        public bool ExistCardID(UserInfo info, bool IsEdit)
        {
            return new DAL.UserInfoDAL().ExistCardID(info, IsEdit);
        }
        public bool ExistPhysicalID(UserInfo info, bool IsEdit)
        {
            return new DAL.UserInfoDAL().ExistPhysicalID(info, IsEdit);
        }
        public bool Update(UserInfo info)
        {
            return new DAL.UserInfoDAL().Update(info);
        }
        public bool Delete(UserInfo info)
        {
            return new DAL.UserInfoDAL().Delete(info);
        }
        public UserInfo GetModelByID(UserInfo info)
        {
            return new DAL.UserInfoDAL().GetModelByID(info);
        }
    }
}
